<%-------------------------------------------------------------------
 * 页面名称：peerInnerAccountDetail.jsp
 * 功能描述：联系人->支付账户->添加
 * Action  : /page/myspace/peerInnerAccountAdd.do
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%
String path = request.getContextPath();
%>

<script type='text/javascript'
	src='<%=path%>/dwr/interface/peerAccountService.js'></script>
<script language="javascript">
	function validateEmailOrMobile(value) {
		value = value.replace(/ /g,"");
		setValue('emailOrMobile', value);
		
		if(getValue('emailOrMobile') == '') {
			return false;
		}
		if(matchValidate(getObj('emailOrMobile'),"URegexType.email|URegexType.mobile",'对方手机或Email')) {
			setValue('emailOrMobile','');
			return false;
		}
		peerAccountService.validateEmailOrMobile(value, <bean:write name="sessionAccountSummary" property="accountId"/>,{
  			callback:function(data) { setInnerText('name',data); },
  			errorHandler:function(errorCode) { processError(errorCode);setValue('emailOrMobile',''); }
		});
	}
	
	function dosubmit() {
		if(getValue('emailOrMobile') == '') {
			alert("请输入对方手机或Email！");
			return false;
		}
		if(matchValidate(getObj('emailOrMobile'),"URegexType.email|URegexType.mobile",'对方手机或Email')) {
			setValue('emailOrMobile','');
			return false;
		}
		
		if (getObj('remark').value.length>100) {
			alert("备注长度必须小于100！");
			return false;
		}
	}
</script>
<div id="main">

	<div class="content_right">
		<div style="width:745px;margin-left:10px;">
			<form action="<%=path%>/page/myspace/peerInnerAccountAdd.do"
				method="post" onSubmit="return dosubmit();">
				<div class="titleinfo">
					新增支付账户
				</div>
				<div class="edit_pass">
					<table width="100%" border="0" align="center" cellpadding="5"
						cellspacing="1">
						<tr>
							<td height="30" align="right">
								<span class="orang12b">*</span> 对方手机或Email：
							</td>
							<td bgcolor="#FFFFFF">
								<label>
									<input name="emailOrMobile" type="text" class="inputStyle"
										size="40"
										onblur="setInnerText('name','');validateEmailOrMobile(this.value)"
										onkeypress="setInnerText('name','')" />
								</label>
							</td>
						</tr>
						<tr>
							<td height="30" align="right">
								对方姓名：
							</td>
							<td bgcolor="#FFFFFF">
								<span id="name"></span>
							</td>
						</tr>
						<tr>
							<td width="27%" height="30" align="right" valign="top">
								备注：
							</td>
							<td width="73%" bgcolor="#FFFFFF">
								<label>
									<textarea name="remark" cols="45" rows="5"
										style="border:1px solid #ccc;"></textarea>
									<br />
									<span class="font_gray">可选(100个字)</span>
								</label>
							</td>
						</tr>
						<tr>
							<td height="55" align="right" valign="top">
								&nbsp;
							</td>
							<td bgcolor="#FFFFFF">
								<input name="submit" type="submit" class="button_style"
									value="确 定" />

								<input name="return" type="button" class="button_style"
									onclick="location.href='<%=path%>/page/myspace/getPeerInnerAccountList.do';"
									value="返 回" />
							</td>
						</tr>
					</table>
				</div>
			</form>
		</div>
	</div>
</div>
